<template>
  <div>
    <el-row class="tac">
      <el-col :span="12">
        <el-menu
          default-active="2"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          unique-opened   
          router
        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-user"></i>
              <span>用户管理</span>
            </template>
            <el-menu-item-group>
              
              <el-menu-item index="/user">用户列表</el-menu-item>
              
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-reading"></i>
              <span>课程管理</span>
            </template>
            <el-menu-item-group>
              
              <el-menu-item index="/class">课程列表</el-menu-item>
              <el-menu-item index="/choice">学生选课</el-menu-item>
              
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
};
</script>

<style>
.el-submenu{
  width: 200px;
}

.el-submenu__title{
  width: 200px;
}
ul{
  width: 199px;
}
</style>